import image, tf

net = "trained.tflite"
labels = [line.rstrip('\n') for line in open("labels.txt")]

def recognize(img):
    label = "None"
    value = 0.0

    for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):

        for lab, val in zip(labels, obj.output()):
            if val > value:
                value = val
                label = lab

    return label, value
